<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Edit Appointment</title>
</head>
<body>
    <h1>Edit Appointment</h1>
    <form action="/appointment/update" method="post">
        <input type="hidden" name="id" value="${appointment.id}">
        <div>
            <label for="title">Title:</label>
            <input type="text" id="title" name="title" value="${appointment.title}" required>
        </div>
        <div>
            <label for="description">Description:</label>
            <textarea id="description" name="description">${appointment.description}</textarea>
        </div>
        <div>
            <label for="startTime">Start Time:</label>
            <input type="datetime-local" id="startTime" name="startTime" value="${appointment.startTime}" required>
        </div>
        <div>
            <label for="endTime">End Time:</label>
            <input type="datetime-local" id="endTime" name="endTime" value="${appointment.endTime}" required>
        </div>
        <div>
            <label for="location">Location:</label>
            <input type="text" id="location" name="location" value="${appointment.location}">
        </div>
        <div>
            <label for="status">Status:</label>
            <select id="status" name="status">
                <option value="1" ${appointment.status == 1 ? 'selected' : ''}>Scheduled</option>
                <option value="2" ${appointment.status == 2 ? 'selected' : ''}>Completed</option>
                <option value="3" ${appointment.status == 3 ? 'selected' : ''}>Cancelled</option>
            </select>
        </div>
        <button type="submit">Update</button>
    </form>
    <br/>
    <a href="/appointment/list">Back to List</a>
</body>
</html>